package com.dawn.webmagic.file.core.example;

import com.dawn.webmagic.file.core.downloader.FileDownloader;
import com.dawn.webmagic.file.core.model.FilePageProcessor;
import com.dawn.webmagic.file.core.model.FilePipeline;
import us.codecraft.webmagic.Spider;

import java.io.FileNotFoundException;

/**
 * @author Ruffianjiang
 * @version V1.0
 * @Title: FileExample
 * @Package webmagic-demo
 * @date 2020/6/11 22:16
 */
public class FileExample {


    public static void main(String[] args) throws FileNotFoundException {

        Spider.create(new FilePageProcessor())
                .addUrl("c://index.html")
                .setDownloader(new FileDownloader())
                .addPipeline(new FilePipeline())
                .thread((Runtime.getRuntime().availableProcessors() - 1) << 1)
                .setExitWhenComplete(false)
                .run();
//                .test("c://index.html");
    }

}
